import { dataAuthTypeMap } from '@/config/dict'

export const dataAuthFormItem = (handleRadioChange, orgDropList, deptDropList, orgIsHide, deptIsHide) => {
  return [
    {
      type: 'radio',
      label: '数据权限范围',
      key: 'rightDataType',
      slotAttrs: {
        options: dataAuthTypeMap
      },
      slotListeners: {
        change: handleRadioChange
      },
      required: true
    },
    {
      type: 'select',
      label: '机构',
      key: 'orgIdList',
      isHide: orgIsHide,
      slotAttrs: {
        multiple: true,
        options: orgDropList,
        style: { width: '300px' }
      },
      required: true
    },
    {
      type: 'select',
      label: '部门',
      key: 'deptIdList',
      isHide: deptIsHide,
      slotAttrs: {
        multiple: true,
        options: deptDropList,
        style: { width: '300px' }
      },
      required: true
    }
  ]
}

export const formButtons = (onSubmit, onReset) => {
  return {
    isDialog: true,
    submitName: '提交',
    resetName: '取消',
    submitCallback: values => onSubmit(values),
    resetCallback: () => onReset()
  }
}

